
export const BVID_SUBTITLE_MAP_DEEPSEEK_CHAT_ID = 'bvid_subtitle_map_deepseek_chat_id'
export const BVID_COMMENTS_MAP_DEEPSEEK_CHAT_ID = 'bvid_comments_map_deepseek_chat_id'




const createChat = async () => {
    const res = await fetch("https://chat.deepseek.com/api/v0/chat_session/create", {
        "headers": {
            "accept": "*/*",
            "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-US;q=0.6",
            "authorization": "Bearer hyyIAIvBhk59DkNTm+ITAFZYhuVC1pPqZZiJ687hrXL4MKvkL02is0ipPPvwROkr",
            "cache-control": "no-cache",
            "content-type": "application/json",
            "pragma": "no-cache",
            "priority": "u=1, i",
            "sec-ch-ua": "\"Chromium\";v=\"134\", \"Not:A-Brand\";v=\"24\", \"Google Chrome\";v=\"134\"",
            "sec-ch-ua-arch": "\"arm\"",
            "sec-ch-ua-bitness": "\"64\"",
            "sec-ch-ua-full-version": "\"134.0.6998.166\"",
            "sec-ch-ua-full-version-list": "\"Chromium\";v=\"134.0.6998.166\", \"Not:A-Brand\";v=\"24.0.0.0\", \"Google Chrome\";v=\"134.0.6998.166\"",
            "sec-ch-ua-mobile": "?0",
            "sec-ch-ua-model": "\"\"",
            "sec-ch-ua-platform": "\"macOS\"",
            "sec-ch-ua-platform-version": "\"15.2.0\"",
            "sec-fetch-dest": "empty",
            "sec-fetch-mode": "cors",
            "sec-fetch-site": "same-origin",
            "x-app-version": "20241129.1",
            "x-client-locale": "zh_CN",
            "x-client-platform": "web",
            "x-client-version": "1.0.0-always"
        },
        "referrer": "https://chat.deepseek.com/",
        "referrerPolicy": "strict-origin-when-cross-origin",
        "body": "{\"character_id\":null}",
        "method": "POST",
        "mode": "cors",
        "credentials": "include"
    }).then((res) => res.json());
    return res?.data?.biz_data?.id
}


const completeChat = async (params: any) => {
    const res = await fetch("https://chat.deepseek.com/api/v0/chat/completion", {
        "headers": {
            "accept": "*/*",
            "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,zh-US;q=0.6",
            "authorization": "Bearer hyyIAIvBhk59DkNTm+ITAFZYhuVC1pPqZZiJ687hrXL4MKvkL02is0ipPPvwROkr",
            "cache-control": "no-cache",
            "content-type": "application/json",
            "pragma": "no-cache",
            "priority": "u=1, i",
            "sec-ch-ua": "\"Chromium\";v=\"134\", \"Not:A-Brand\";v=\"24\", \"Google Chrome\";v=\"134\"",
            "sec-ch-ua-arch": "\"arm\"",
            "sec-ch-ua-bitness": "\"64\"",
            "sec-ch-ua-full-version": "\"134.0.6998.166\"",
            "sec-ch-ua-full-version-list": "\"Chromium\";v=\"134.0.6998.166\", \"Not:A-Brand\";v=\"24.0.0.0\", \"Google Chrome\";v=\"134.0.6998.166\"",
            "sec-ch-ua-mobile": "?0",
            "sec-ch-ua-model": "\"\"",
            "sec-ch-ua-platform": "\"macOS\"",
            "sec-ch-ua-platform-version": "\"15.2.0\"",
            "sec-fetch-dest": "empty",
            "sec-fetch-mode": "cors",
            "sec-fetch-site": "same-origin",
            "x-app-version": "20241129.1",
            "x-client-locale": "zh_CN",
            "x-client-platform": "web",
            "x-client-version": "1.0.0-always",
            "x-ds-pow-response": "eyJhbGdvcml0aG0iOiJEZWVwU2Vla0hhc2hWMSIsImNoYWxsZW5nZSI6Ijg3NjhlY2ZlZjE3Njc1Mzc3MTI1MTBkYTM3NjhiODZiYzViNjYwZDA4MGQ0MmY1YTM4YTA0ZmQ5NTAwOTc1NzkiLCJzYWx0IjoiNjIzNDMzMmI3OWNmM2EyOTM5MzgiLCJhbnN3ZXIiOjMzMDY3LCJzaWduYXR1cmUiOiJhZmUzZWFhMzRmYTFmZWUzNGVjYTU0YjY0YTFmM2NkMmZmZWE5YjJiNGE0Njg3MDRjOThjZDVlOTc2ZjI0N2I1IiwidGFyZ2V0X3BhdGgiOiIvYXBpL3YwL2NoYXQvY29tcGxldGlvbiJ9"
        },
        "referrer": "https://chat.deepseek.com/a/chat/s/1eda437d-1934-4b4c-b16c-f1b8566c902c",
        "referrerPolicy": "strict-origin-when-cross-origin",
        "body": JSON.stringify(params),
        "method": "POST",
        "mode": "cors",
        "credentials": "include"
    });
    return res?.json();

}

const uploadFile = async (file: File) => {
    const res = await fetch('https://chat.deepseek.com/api/v0/file/upload_file', {
        method: 'POST',
        body: file
    }).then((res) => res.json());
    return res?.data?.biz_data?.id
}


export default {
    createChat,
    completeChat,
    uploadFile
}